//    Copyright (C) Kherty.  All rights reserved.
using System;
using System.Diagnostics;
using System.Windows.Input;
using OpenLS.Spreadsheet.UI.Internals;
using OpenLS.Spreadsheet.UI.Internals.Resources;

namespace OpenLS.Spreadsheet.UI
{
    ///<summary>
    /// Provides spreadsheet specific commands
    ///</summary>
    public static class SpreadsheetCommands
    {
        private enum CommandId
        {
            SetDataValidation,
            ClearDataValidation,
            SetTabColor,
            GetDataFromText,
            SetPrintArea,
            ClearPrintArea,
            PageSetup,
            ProtectSheet,
            UnprotectSheet,
            ProtectWorkbook,
            UnprotectWorkbook,
            FindConditionalFormatting,
            FindComments,
            FindFormulas,
            FindConstants,
            FindDataValidation,
            CreateAndApplyRule,
            ClearSheetRules,
            ClearSelectionRules,
            ClearTableRules,
            NewRule,
            ManageRules,
            ApplyRule,
            ConvertToRange,
            RemoveDuplicates,
            DisplayFilter,
            SwitchWindow,
            InsertWorksheet,
            RenameWorksheet,
            Group,
            Ungroup,

            NameManager,
            AutoFitColumnWidth,
            AutoFitRowHeight,
            SetColumnWidth,
            SetRowHeight,
            SetStyle,
            FormatAsTable,
            FormatAsStandardTable,
            SaveAsXps,
            DeleteComment,
            ToggleCellLock,
            ToggleCommentVisibility,
            ToggleAllCommentsVisibility,
            NextComment,
            PreviousComment,
            EditComment,
            NewComment,
            Enter,
            Escape,
            DeleteCells,
            InsertCells,
            //InsertSheet,
            InsertRow,
            InsertColumn,
            DeleteSheet,
            DeleteRow,
            DeleteColumn,
            DeleteRows,
            DeleteColumns,
            //Insert,
            //InsertPieChart,
            //InsertLineChart,
            //InsertAreaChart,
            //InsertBarChart,
            InsertChart,
            //InsertBar3DChart,
            InsertPicture,
            SelectColumn,
            SelectRow,
            BringToFront,
            BringForward,
            SendToBack,
            SendBackward,
            StopEditing,
            MoveTo,
            DecreaseDecimal,
            IncreaseDecimal,
            FormatCells,
            DefineName,
            AutoSum,
            InsertFunction,
            ApplyFilter,
            ReApplyFilter,
            ClearFilter,
            ClearFilterColumn,
            CustomSort,
            SortUp,
            SortDown,
            CalculateWorksheet,
            CalculateWorkbook,
            SetCalculationMode,
            //Hide,
            //Unhide,
            HideColumns,
            UnhideColumns,
            HideRows,
            UnhideRows,
            HideSheet,
            UnhideSheet,
            MoveOrCopySheet,
            Fill,
            BigDataTableManager,
            Login,
            Register,
            Logout,
            MarketData,
            Last
        }

        public static RoutedUICommand Fill
        {
            get {  return EnsureCommand(CommandId.Fill); }
        }
        public static RoutedUICommand SetCalculationMode
        {
            get { return EnsureCommand(CommandId.SetCalculationMode); }
        }
        public static RoutedUICommand CalculateWorkbook
        {
            get { return EnsureCommand(CommandId.CalculateWorkbook, "CalculateFull"); }
        }

        public static RoutedUICommand CalculateWorksheet
        {
            get { return EnsureCommand(CommandId.CalculateWorksheet, "CalculateSheet"); }
        }

        public static RoutedUICommand SelectColumn
        {
            get { return EnsureCommand(CommandId.SelectColumn); }
        }

        public static RoutedUICommand SelectRow
        {
            get { return EnsureCommand(CommandId.SelectRow); }
        }

        public static RoutedUICommand BringToFront
        {
            get { return EnsureCommand(CommandId.BringToFront, "ObjectBringToFront"); }
        }

        public static RoutedUICommand BringForward
        {
            get { return EnsureCommand(CommandId.BringForward, "ObjectBringForward"); }
        }

        public static RoutedUICommand SendToBack
        {
            get { return EnsureCommand(CommandId.SendToBack, "ObjectSendToBack"); }
        }

        public static RoutedUICommand SendBackward
        {
            get { return EnsureCommand(CommandId.SendBackward, "ObjectSendBackward"); }
        }

        public static RoutedUICommand StopEditing
        {
            get { return EnsureCommand(CommandId.StopEditing); }
        }

        public static RoutedUICommand MoveTo
        {
            get { return EnsureCommand(CommandId.MoveTo); }
        }

        /// <summary>
        /// Command to decrease the number of decimals.
        /// </summary>
        public static RoutedUICommand DecreaseDecimal
        {
            get { return EnsureCommand(CommandId.DecreaseDecimal); }
        }

        /// <summary>
        /// Command to increase the number of decimals.
        /// </summary>
        public static RoutedUICommand IncreaseDecimal
        {
            get { return EnsureCommand(CommandId.IncreaseDecimal);
            }
        }

        ///<summary>
        /// Command to popup a format cell window.
        ///</summary>
        public static RoutedUICommand FormatCells
        {
            get { return EnsureCommand(CommandId.FormatCells); }
        }

        public static RoutedUICommand DefineName
        {
            get { return EnsureCommand(CommandId.DefineName, "DefineName"); }
        }

        public static RoutedUICommand NameManager
        {
            get { return EnsureCommand(CommandId.NameManager); }
        }

        public static RoutedUICommand BigDataTableManager
        {
            get { return EnsureCommand(CommandId.BigDataTableManager); }
        }

        public static RoutedUICommand MarketData
        {
            get { return EnsureCommand(CommandId.MarketData); }
        }

        public static RoutedUICommand Login
        {
            get { return EnsureCommand(CommandId.Login); }
        }

        public static RoutedUICommand Register
        {
            get { return EnsureCommand(CommandId.Register); }
        }

        public static RoutedUICommand Logout
        {
            get { return EnsureCommand(CommandId.Logout); }
        }

        public static RoutedUICommand Group
        {
            get
            {
                return EnsureCommand(CommandId.Group, "OutlineGroup",
                                     new KeyGesture(Key.Right, ModifierKeys.Alt | ModifierKeys.Shift));
            }
        }
        public static RoutedUICommand Ungroup
        {
            get
            {
                return EnsureCommand(CommandId.Ungroup, "OutlineUngroup",
                                     new KeyGesture(Key.Left, ModifierKeys.Alt | ModifierKeys.Shift));
            }
        }

        public static RoutedUICommand AutoSum
        {
            get { return EnsureCommand(CommandId.AutoSum); }
        }

        public static RoutedUICommand AutoFitColumnWidth
        {
            get { return EnsureCommand(CommandId.AutoFitColumnWidth); }
        }

        public static RoutedUICommand AutoFitRowHeight
        {
            get { return EnsureCommand(CommandId.AutoFitRowHeight); }
        }

        public static RoutedUICommand SetColumnWidth
        {
            get { return EnsureCommand(CommandId.SetColumnWidth); }
        }

        public static RoutedUICommand SetRowHeight
        {
            get { return EnsureCommand(CommandId.SetRowHeight, "RowHeight"); }
        }

        public static RoutedCommand ApplyFilter
        {
            get { return EnsureCommand(CommandId.ApplyFilter, "FilterToggleFilter"); }
        }
        public static RoutedCommand ClearFilter
        {
            get { return EnsureCommand(CommandId.ClearFilter, "FilterClearAllFilters"); }
        }
        public static RoutedCommand ClearFilterColumn
        {
            get { return EnsureCommand(CommandId.ClearFilterColumn, "FilterClearAllFilters"); }
        }
        public static RoutedCommand ReApplyFilter
        {
            get { return EnsureCommand(CommandId.ReApplyFilter, "FilterReapply"); }
        }
        public static RoutedCommand SortUp
        {
            get { return EnsureCommand(CommandId.SortUp); }
        }

        public static RoutedCommand SortDown
        {
            get { return EnsureCommand(CommandId.SortDown); }
        }

        public static RoutedCommand SetStyle
        {
            get { return EnsureCommand(CommandId.SetStyle); }
        }
        public static RoutedCommand FormatAsTable
        {
            get { return EnsureCommand(CommandId.FormatAsTable, "TableInsert"); }
        }

        public static RoutedCommand FormatAsStandardTable
        {
            get { return EnsureCommand(CommandId.FormatAsStandardTable, "StandardTableInsert"); }
        }

        public static RoutedCommand SaveAsXps
        {
            get { return EnsureCommand(CommandId.SaveAsXps); }
        }

        ////====\\== ublic RoutedUICommand InsertFunction { get { return insertFunction; } }

        public static RoutedUICommand InsertFunction
        {
            get { return EnsureCommand(CommandId.InsertFunction); }
        }

        //static private RoutedCommand select = new RoutedCommand("Select", typeof(SpreadsheetCommands));
        //static public RoutedCommand Select { get { return select; } }

        public static RoutedCommand DeleteComment
        {
            get { return EnsureCommand(CommandId.DeleteComment, "ReviewDeleteComment"); }
        }
        public static RoutedUICommand PreviousComment
        {
            get { return EnsureCommand(CommandId.PreviousComment, "ReviewPreviousComment"); }
        }
        public static RoutedUICommand ToggleCommentVisibility
        {
            get { return EnsureCommand(CommandId.ToggleCommentVisibility); }
        }
        public static RoutedUICommand ToggleCellLock
        {
            get { return EnsureCommand(CommandId.ToggleCellLock); }
        }
        public static RoutedUICommand ToggleAllCommentsVisibility
        {
            get { return EnsureCommand(CommandId.ToggleAllCommentsVisibility); }
        }
        ///<summary>
        /// Get the command which navigates to the next comment
        ///</summary>
        public static RoutedUICommand NextComment
        {
            get { return EnsureCommand(CommandId.NextComment, "ReviewNextComment"); }
        }

        public static RoutedUICommand EditComment
        {
            get { return EnsureCommand(CommandId.EditComment, "ReviewEditComment"); }
        }
        public static RoutedUICommand NewComment
        {
            get { return EnsureCommand(CommandId.NewComment, "ReviewNewComment"); }
        }
        public static RoutedUICommand Enter
        {
            get { return EnsureCommand(CommandId.Enter); }
        }
        public static RoutedUICommand Escape
        {
            get { return EnsureCommand(CommandId.Escape); }
        }

        public static RoutedUICommand DeleteCells
        {
            get { return EnsureCommand(CommandId.DeleteCells, "CellsDelete"); }
        }

        public static RoutedUICommand InsertCells
        {
            get { return EnsureCommand(CommandId.InsertCells, "CellsInsertDialog"); }
        }

        public static RoutedUICommand SwitchWindow
        {
            get { return EnsureCommand(CommandId.SwitchWindow); }
        }
        public static RoutedUICommand DisplayFilter
        {
            get { return EnsureCommand(CommandId.DisplayFilter); }
        }
        public static RoutedUICommand ConvertToRange
        {
            get { return EnsureCommand(CommandId.ConvertToRange, "TableConvertToRange"); }
        }
        public static RoutedUICommand RemoveDuplicates
        {
            get { return EnsureCommand(CommandId.RemoveDuplicates); }
        }
        public static RoutedUICommand InsertWorksheet
        {
            get { return EnsureCommand(CommandId.InsertWorksheet, "SheetInsert"); }
        }
        public static RoutedUICommand RenameWorksheet
        {
            get { return EnsureCommand(CommandId.RenameWorksheet, "SheetRename"); }
        }

        public static RoutedUICommand ApplyRule
        {
            get { return EnsureCommand(CommandId.ApplyRule); }
        }
        public static RoutedUICommand ManageRules
        {
            get { return EnsureCommand(CommandId.ManageRules, "ConditionalFormattingManage"); }
        }
        public static RoutedUICommand ClearTableRules
        {
            get { return EnsureCommand(CommandId.ClearTableRules); }
        }
        public static RoutedUICommand ClearSelectionRules
        {
            get { return EnsureCommand(CommandId.ClearSelectionRules); }
        }
        public static RoutedUICommand ClearSheetRules
        {
            get { return EnsureCommand(CommandId.ClearSheetRules); }
        }
        public static RoutedUICommand NewRule
        {
            get { return EnsureCommand(CommandId.NewRule, "ConditionalFormattingNewRule"); }
        }
        public static RoutedUICommand CreateAndApplyRule
        {
            get { return EnsureCommand(CommandId.CreateAndApplyRule); }
        }
        public static RoutedUICommand FindConditionalFormatting
        {
            get { return EnsureCommand(CommandId.FindConditionalFormatting); }
        }
        public static RoutedUICommand FindComments
        {
            get { return EnsureCommand(CommandId.FindComments); }
        }
        public static RoutedUICommand FindFormulas
        {
            get { return EnsureCommand(CommandId.FindFormulas); }
        }
        public static RoutedUICommand FindConstants
        {
            get { return EnsureCommand(CommandId.FindConstants); }
        }
        public static RoutedUICommand FindDataValidation
        {
            get { return EnsureCommand(CommandId.FindDataValidation); }
        }
        public static RoutedUICommand InsertRow
        {
            get { return EnsureCommand(CommandId.InsertRow, "TableRowsInsert"); }
        }
        public static RoutedUICommand ProtectSheet
        {
            get { return EnsureCommand(CommandId.ProtectSheet, "SheetProtect"); }
        }
        public static RoutedUICommand ProtectWorkbook
        {
            get { return EnsureCommand(CommandId.ProtectWorkbook, "WorkbookProtect"); }
        }
        public static RoutedUICommand UnprotectWorkbook
        {
            get { return EnsureCommand(CommandId.UnprotectWorkbook, "WorkbookProtect"); }
        }
        public static RoutedUICommand SetPrintArea
        {
            get { return EnsureCommand(CommandId.SetPrintArea); }
        }
        public static RoutedUICommand GetDataFromText
        {
            get { return EnsureCommand(CommandId.GetDataFromText); }
        }

        public static RoutedUICommand SetTabColor
        {
            get { return EnsureCommand(CommandId.SetTabColor); }
        }

        public static RoutedUICommand SetDataValidation
        {
            get { return EnsureCommand(CommandId.SetDataValidation); }
        }

        public static RoutedUICommand ClearDataValidation
        {
            get { return EnsureCommand(CommandId.ClearDataValidation); }
        }

        public static RoutedUICommand ClearPrintArea
        {
            get { return EnsureCommand(CommandId.ClearPrintArea); }
        }
        public static RoutedUICommand PageSetup
        {
            get { return EnsureCommand(CommandId.PageSetup); }
        }
        public static RoutedUICommand UnprotectSheet
        {
            get { return EnsureCommand(CommandId.UnprotectSheet, "SheetProtect"); }
        }
        public static RoutedUICommand InsertColumn
        {
            get { return EnsureCommand(CommandId.InsertColumn, "TableColumnsInsert"); }
        }

        public static RoutedUICommand DeleteSheet
        {
            get { return EnsureCommand(CommandId.DeleteSheet, "SheetDelete"); }
        }

        public static RoutedUICommand DeleteRowobsolete
        {
            get { return EnsureCommand(CommandId.DeleteRow); }
        }

        public static RoutedUICommand DeleteColumnobsolete
        {
            get { return EnsureCommand(CommandId.DeleteColumn, "TableColumnsDelete"); }
        }

        public static RoutedUICommand DeleteRows
        {
            get { return EnsureCommand(CommandId.DeleteRows, "TableRowsDelete"); }
        }

        public static RoutedUICommand DeleteColumns
        {
            get { return EnsureCommand(CommandId.DeleteColumns, "TableColumnsDelete"); }
        }

        /*  static public RoutedUICommand InsertPieChart
        {
            get { return EnsureCommand(CommandId.InsertPieChart, "PieChart"); }
        }
        /*
         * static public RoutedUICommand InsertColumnChart
        {
            get { return EnsureCommand(CommandId.InsertColumnChart, "ColumnClustered"); }
        }*/
        public static RoutedUICommand InsertChart
        {
            get { return EnsureCommand(CommandId.InsertChart, "ColumnClustered"); }
        }

        /*  static public RoutedUICommand InsertBar3DChart
        {
            get { return EnsureCommand(CommandId.InsertBar3DChart); }
        }
       /* static public RoutedUICommand InsertColumn3DChart
        {
            get { return EnsureCommand(CommandId.InsertColumn3DChart); }
        }*/

        public static RoutedUICommand InsertPicture
        {
            get { return EnsureCommand(CommandId.InsertPicture); }
        }
        public static RoutedUICommand CustomSort
        {
            get { return EnsureCommand(CommandId.CustomSort, "SortDialog"); }
        }
        /// <summary>
        /// 
        /// Get the command to hide a sheet
        /// </summary>
        public static RoutedUICommand HideSheet
        {
            get { return EnsureCommand(CommandId.HideSheet); }
        }
        public static RoutedUICommand MoveOrCopySheet
        {
            get { return EnsureCommand(CommandId.MoveOrCopySheet); }
        }
        /// <summary>
        /// Get the command to unhide a sheet
        /// </summary>
        public static RoutedUICommand UnhideSheet
        {
            get { return EnsureCommand(CommandId.UnhideSheet); }
        }

        ///<summary>
        /// Get the command to hide a set of columns
        ///</summary>
        public static RoutedUICommand HideColumns
        {
            get { return EnsureCommand(CommandId.HideColumns); }
        }
        /// <summary>
        /// Get the command to unhide a set of columns
        /// </summary>
        public static RoutedUICommand UnhideColumns
        {
            get { return EnsureCommand(CommandId.UnhideColumns); }
        }
        /// <summary>
        /// Get the command to hide a set of rows
        /// </summary>
        public static RoutedUICommand HideRows
        {
            get { return EnsureCommand(CommandId.HideRows); }
        }
        ///<summary>
        /// Get the command to unhide a set of rows
        ///</summary>
        public static RoutedUICommand UnhideRows
        {
            get { return EnsureCommand(CommandId.UnhideRows); }
        }

        private static readonly RoutedCommand _InsertCurrentDate = new RoutedCommand("InsertDate",
                                                                                     typeof (SpreadsheetCommands));
        internal static RoutedCommand InsertCurrentDate
        {
            get { return _InsertCurrentDate; }
        }

        private static readonly RoutedCommand _InsertCurrentTime = new RoutedCommand("InsertTime",
                                                                                     typeof (SpreadsheetCommands));
        internal static RoutedCommand InsertCurrentTime
        {
            get { return _InsertCurrentTime; }
        }

        private static RoutedUICommand EnsureCommand(CommandId idCommand)
        {
            return EnsureCommand(idCommand, idCommand.ToString());
        }

        private static RoutedUICommand EnsureCommand(CommandId idCommand, string propertyName)
        {
            lock (_internalCommands.SyncRoot)
            {
                if (_internalCommands[(int) idCommand] == null)
                {
                    var newCommand = new RoutedUICommand(GetUIText(idCommand), propertyName,
                                                         typeof (SpreadsheetCommands));
                    _internalCommands[(int) idCommand] = newCommand;
                }
            }
            return _internalCommands[(int) idCommand];
        }

        private static RoutedUICommand EnsureCommand(CommandId idCommand, string propertyName,
                                                     params InputGesture[] gestures)
        {
            lock (_internalCommands.SyncRoot)
            {
                if (_internalCommands[(int) idCommand] == null)
                {
                    InputGestureCollection gestureCollection = null;
                    if (gestures != null && gestures.Length > 0)
                    {
                        gestureCollection = new InputGestureCollection();
                        gestureCollection.AddRange(gestures);
                    }
                    var newCommand = new RoutedUICommand(GetUIText(idCommand), propertyName,
                                                         typeof (SpreadsheetCommands), gestureCollection);
                    _internalCommands[(int) idCommand] = newCommand;
                }
            }
            return _internalCommands[(int) idCommand];
        }

        // SJE 23-07: Be careful to update for each new command in the spreadsheet
        private static readonly RoutedUICommand[] _internalCommands = new RoutedUICommand[(int) CommandId.Last];

        private static string GetUIText(CommandId idCommand)
        {
            switch (idCommand)
            {
                case CommandId.SetDataValidation:
                    return UIStringTable.SetDataValidation;
                case CommandId.ClearDataValidation:
                    return UIStringTable.ClearDataValidation;
                case CommandId.ProtectSheet:
                    return UIStringTable.ProtectSheet;
                case CommandId.ProtectWorkbook:
                    return UIStringTable.ProtectWorkbook;
                case CommandId.UnprotectWorkbook:
                    return UIStringTable.UnprotectWorkbook;
                case CommandId.ClearPrintArea:
                    return UIStringTable.ClearPrintArea_;
                case CommandId.SetPrintArea:
                    return UIStringTable.SetPrintArea_;
                case CommandId.SetTabColor:
                    return UIStringTable.TabColor;
                case CommandId.GetDataFromText:
                    return UIStringTable.GetDataFromText;
                case CommandId.PageSetup:
                    return UIStringTable.PageSetup;
                case CommandId.UnprotectSheet:
                    return UIStringTable.UnprotectSheet;
                case CommandId.FindConditionalFormatting:
                    return UIStringTable.ConditionalFormatting;
                case CommandId.FindComments:
                    return UIStringTable.Comments;
                case CommandId.FindFormulas:
                    return UIStringTable.Formulas;
                case CommandId.FindConstants:
                    return UIStringTable.Constants;
                case CommandId.FindDataValidation:
                    return UIStringTable.DataValidation;
                case CommandId.ApplyRule:
                    return UIStringTable.ApplyRule;
                case CommandId.ClearTableRules:
                    return UIStringTable.ClearTableRules;
                case CommandId.ClearSelectionRules:
                    return UIStringTable.ClearSelectionRules;
                case CommandId.ClearSheetRules:
                    return UIStringTable.ClearSheetRules;
                case CommandId.ManageRules:
                    return UIStringTable.ManageRules;
                case CommandId.NewRule:
                    return UIStringTable.NewRule;
                case CommandId.CreateAndApplyRule:
                    return "CreateAndApplyRule";
                case CommandId.ConvertToRange:
                    return UIStringTable.ConvertToRange;
                case CommandId.RemoveDuplicates:
                    return UIStringTable.RemoveDuplicates;
                case CommandId.DisplayFilter:
                    return UIStringTable.DisplayFilter;
                case CommandId.SwitchWindow:
                    return UIStringTable.SwitchWindow;

                case CommandId.InsertFunction:
                    return UIStringTable.InsertFunction;
                case CommandId.ApplyFilter:
                    return UIStringTable.ApplyFilter;
                case CommandId.ReApplyFilter:
                    return UIStringTable.ReApplyFilter;
                case CommandId.ClearFilter:
                    return UIStringTable.ClearFilter;
                case CommandId.CustomSort:
                    return UIStringTable.CustomSort;
                case CommandId.SortDown:
                    return UIStringTable.SortDown;
                case CommandId.SortUp:
                    return UIStringTable.SortUp;
                case CommandId.CalculateWorkbook:
                    return UIStringTable.CalculateWorkbook;
                case CommandId.CalculateWorksheet:
                    return UIStringTable.CalculateWorksheet;
                case CommandId.SetCalculationMode:
                    return UIStringTable.SetCalculationMode;
                case CommandId.HideSheet:
                    return UIStringTable.HideSheet;
                case CommandId.UnhideSheet:
                    return UIStringTable.UnhideSheet;
                case CommandId.MoveOrCopySheet:
                    return UIStringTable.MoveOrCopy;
                case CommandId.HideColumns:
                    return UIStringTable.HideColumns;
                case CommandId.UnhideColumns:
                    return UIStringTable.UnhideColumns;
                case CommandId.HideRows:
                    return UIStringTable.HideRows;
                case CommandId.UnhideRows:
                    return UIStringTable.UnhideRows;
                case CommandId.Fill:
                    return UIStringTable.Fill;
                case CommandId.InsertColumn:
                    return UIStringTable.InsertColumn;
                case CommandId.SaveAsXps:
                    return UIStringTable.SaveAsXps;
                case CommandId.FormatCells:
                    return UIStringTable.FormatCells;
                case CommandId.IncreaseDecimal:
                    return UIStringTable.IncreaseDecimal;
                case CommandId.DecreaseDecimal:
                    return UIStringTable.DecreaseDecimal;
                case CommandId.SetStyle:
                    return UIStringTable.SetStyle;
                case CommandId.FormatAsTable:
                    return UIStringTable.FormatAsTable;
                case CommandId.InsertCells:
                    return UIStringTable.InsertCells;
                case CommandId.InsertRow:
                    return UIStringTable.InsertRow;
                case CommandId.InsertWorksheet:
                    return UIStringTable.InsertWorksheet;
                case CommandId.RenameWorksheet:
                    return UIStringTable.Rename;
                case CommandId.DeleteCells:
                    return UIStringTable.DeleteCells;
                case CommandId.DeleteRows:
                    return UIStringTable.DeleteRows;
                case CommandId.DeleteColumns:
                    return UIStringTable.DeleteColumns;
                case CommandId.DeleteSheet:
                    return UIStringTable.DeleteSheet;
                case CommandId.SetRowHeight:
                    return UIStringTable.SetRowHeight;
                case CommandId.AutoFitRowHeight:
                    return UIStringTable.AutoFitRowHeight;
                case CommandId.SetColumnWidth:
                    return UIStringTable.SetColumnWidth;
                case CommandId.AutoFitColumnWidth:
                    return UIStringTable.AutoFitColumnWidth;
                case CommandId.AutoSum:
                    return UIStringTable.AutoSum;
                case CommandId.DeleteComment:
                    return UIStringTable.DeleteComment;
                case CommandId.InsertPicture:
                    return UIStringTable.InsertPicture;
                    // case CommandId.InsertColumnChart: return UIStringTable.InsertColumnChart;
                case CommandId.InsertChart:
                    return UIStringTable.InsertChart;
                    //case CommandId.InsertPieChart: return UIStringTable.InsertPieChart;
                case CommandId.BringToFront:
                    return UIStringTable.BringToFront;
                case CommandId.BringForward:
                    return UIStringTable.BringForward;
                case CommandId.SendToBack:
                    return UIStringTable.SendToBack;
                case CommandId.SendBackward:
                    return UIStringTable.SendBackward;
                case CommandId.NameManager:
                    return UIStringTable.NameManager;
                case CommandId.Group:
                    return UIStringTable.Group;
                case CommandId.Ungroup:
                    return UIStringTable.Ungroup;
                case CommandId.DefineName:
                    return UIStringTable.DefineName;
                case CommandId.NewComment:
                    return UIStringTable.NewComment;
                case CommandId.EditComment:
                    return UIStringTable.EditComment;
                case CommandId.PreviousComment:
                    return UIStringTable.PreviousComment;
                case CommandId.ToggleCommentVisibility:
                    return UIStringTable.ToggleCommentVisibility;
                case CommandId.ToggleCellLock:
                    return UIStringTable.ToggleCellLock;
                case CommandId.ToggleAllCommentsVisibility:
                    return UIStringTable.ToggleAllCommentsVisibility;
                case CommandId.NextComment:
                    return UIStringTable.NextComment;
                case CommandId.ClearFilterColumn:
                    return UIStringTable.ClearFilterColumn;
                case CommandId.MoveTo:
                    return UIStringTable.MoveTo;
                case CommandId.SelectRow:
                    return UIStringTable.SelectRow;
                case CommandId.SelectColumn:
                    return UIStringTable.SelectColumn;
                case CommandId.Enter:
                    return UIStringTable.Enter;
                case CommandId.Escape:
                    return UIStringTable.Escape;
                default:
                    Debug.WriteLine(string.Format("case CommandId.{0}: return UIStringTable.{0};", idCommand));
                    return "not implemented " + idCommand;
/*
                    throw new NotImplementedException();
*/
            }
        }
    }
}